<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ page isELIgnored="false"%>
<head>
<head>
<link href="${pageContext.request.contextPath}/system/page.css"
	rel="stylesheet" />
</head>

<script type="text/javascript">
	function deleteAllCallback(json) {
		if(json.statusCode==200){
		alertMsg.info(json.message, {
                okCall: function(){
                               $("#pageForm").submit();;
                }
        });
			
		}else{
			alertMsg.error(json.message);
		}
	}
	function gotoPage(pageNo) {
		$("#pageNo").val(pageNo);
		$("#pageForm").submit();
	}

	function deleteOne(id) {
		if (id == "" || id == null) {
			return;
		}
		art.dialog({
					content : '删除后不可恢复,请确认操作',
					// okVal:'确认删除',
					lock : true,
					ok : function() {
						$("#pageForm")
								.attr("action",
										"${pageContext.request.contextPath}/system/sysRoleDelete.do");
						$("#pageForm #id").val(id);
						$("#pageForm").submit();
						this.title('1秒后自动关闭').time(1);
						return false;
					},
					cancelVal : '关闭',
					cancel : true
				//为true等价于function(){}

				});
	}
	function view(id) {
		if (id == "" || id == null) {
			return;
		}
		$("#pageForm").attr("action",
				"${pageContext.request.contextPath}/system/sysRoleView.do");
		$("#pageForm #id").val(id);
		$("#pageForm").submit();
	}
	function edit(id) {
		if (id == "" || id == null) {
			return;
		}
		$("#pageForm").attr("action",
				"${pageContext.request.contextPath}/system/sysRoleEdit.do");
		$("#pageForm #id").val(id);
		$("#pageForm").submit();
	}

	function gotoPageChangePageSize(value) {
		$("#pageForm #pageSize").val(value);
		$("#pageForm").submit();
	}
	function sysRoleRight(value) {
		$("#pageForm")
				.attr("action",
						"${pageContext.request.contextPath}/system/sysRoleRightList.do");
		$("#pageForm #id").val(value);
		$("#pageForm").submit();
	}
</script>
<form id="pageForm" method="post"
	action="${pageContext.request.contextPath}/system/sysRoleList.do"
	onsubmit="return navTabSearch(this);">
	<input type="hidden" id="pageSize" name="page.pageSize"
		value="${page.pageSize}" /> <input type="hidden" id="pageNo"
		name="page.pageNo" value="${page.pageNo}" /> <input type="hidden"
		name="orderField" id="orderField" value="${orderField}" /> <input
		type="hidden" name="id" id="id" value="" /> <input type="hidden"
		name="queryStr" id="queryStr" value="${queryStr}" /> <input
		type="hidden" name="backUrl" id="backUrl" value="${backUrl}" />
</form>

<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<s:iterator value="rights" status="status" id="id">
				<s:if test="#id.equals('deleteAll')">
					<li><a title="确实要删除这些记录吗?" target="selectedTodo" rel="ids"
						posttype="string" callback="deleteAllCallback"
						href="${pageContext.request.contextPath}/system/sysRoleDeleteAll.do"
						class="delete"><span>批量删除</span></a></li>
				</s:if>
				<s:if test="#id.equals('add')">
					<li><a class="add"
						href="${pageContext.request.contextPath}/system/sysRoleAdd.do"
						target="navTab"><span>添加</span> </a></li>
				</s:if>
			</s:iterator>
			<!-- <li>
				<a class="edit"
					href="${pageContext.request.contextPath}/system/systemEdit.do"
					target="navTab"><span>修改</span> </a>
			</li>
			<li class="line">
				line
			</li>
			<li>
				<a class="icon" href="demo/common/dwz-team.xls" target="dwzExport"
					targetType="navTab" title="实要导出这些记录吗?"><span>导出EXCEL</span> </a>
			</li> 
			-->
		</ul>
	</div>
	<table class="table" width="100%" layoutH="78" nowrapTD="false">
		<thead>
			<tr>
				<th width="43">
					<div class="gridCol" title="">
						<input type="checkbox" group="ids" class="checkboxCtrl">
					</div>
				</th>
				<th width="80">roleid</th>
				<th width="80">rolename</th>
				<th width="80">roletype</th>
				<th width="80">comments</th>
				<th width="80">createuser</th>
				<th width="80">createtime</th>
				<th width="80">modifyuser</th>
				<th width="80">rightobj</th>
				<th width="80">operatetype</th>
				<th width="80">操作</th>
			</tr>
		</thead>
		<tbody>
			<s:iterator value="page.items" status="item" id="item">
				<tr target="sid_user" rel="1">
					<td style="width: 43px;">
						<div>
							<input name="ids" value="${roleid}" type="checkbox">
						</div>
					</td>
					<td width="80">${roleid}</td>
					<td width="80">${rolename}</td>
					<td width="80">${roletype}</td>
					<td width="80">${comments}</td>
					<td width="80">${createuser}</td>
					<td width="80"><s:date name="createtime" format="yyyy-mm-dd" /></td>
					<td width="80">${modifyuser}</td>
					<td width="80">${rightobj}</td>
					<td width="80">${operatetype}</td>
					<td>
						<div>
							<s:iterator value="rights" status="status" id="id">
								<s:if test="#id.equals('edit')">
									<a title="编辑" href="javascript:edit('${roleid}')"
										class="btnEdit">编辑</a>
								</s:if>
								<s:if test="#id.equals('delete')">
									<a title="删除" href="javascript:deleteOne('${roleid}')"
										class="btnDel">删除</a>
								</s:if>
								<s:if test="#id.equals('view')">
									<a title="查看" href="javascript:view('${roleid}');"
										class="btnView">查看</a>
								</s:if>
							</s:iterator>

							<a title="权限" href="javascript:sysRoleRight('${roleid}');"
								class="btnView">权限</a>
						</div>
					</td>
				</tr>
			</s:iterator>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages2">
			<jsp:include page="../system/page.jsp" flush="true"></jsp:include>
		</div>
	</div>
</div>
